﻿
namespace Coproject.Web.Models
{
	using System;
	using System.Collections.Generic;
	using System.ComponentModel;
	using System.ComponentModel.DataAnnotations;
	using System.Data.Objects.DataClasses;
	using System.Linq;
	using System.ServiceModel.DomainServices.Hosting;
	using System.ServiceModel.DomainServices.Server;


	// The MetadataTypeAttribute identifies ToDoItemMetadata as the class
	// that carries additional metadata for the ToDoItem class.
	[MetadataTypeAttribute(typeof(ToDoItem.ToDoItemMetadata))]
	public partial class ToDoItem
	{

		// This class allows you to attach custom attributes to properties
		// of the ToDoItem class.
		//
		// For example, the following marks the Xyz property as a
		// required property and specifies the format for valid values:
		//    [Required]
		//    [RegularExpression("[A-Z][A-Za-z0-9]*")]
		//    [StringLength(32)]
		//    public string Xyz { get; set; }
		internal sealed class ToDoItemMetadata
		{

			// Metadata classes are not meant to be instantiated.
			private ToDoItemMetadata()
			{
			}

			public DateTime CreatedDate { get; set; }

			[Display(Name = "Task", Description = "Describe the To-do task.")]
			[Required]
			[StringLength(40)]
			public string Content { get; set; }

			[Range(typeof(DateTime), "1.1.2010", "31.12.2019")]
			[Display(Name = "Deadline", Description = "The latest possible date the task must be finished.")]
			public Nullable<DateTime> DueDate { get; set; }

			[Include]
			[Association("FK_ToDoItems_Users", "UserID", "UserID", IsForeignKey = true)]
			[Display(Name = "Assigned user")]
			public User User;

			[Key]
			public int ToDoItemID { get; set; }

			[Include]
			[Association("FK_ToDoItems_ToDoLists", "ToDoListID", "ToDoListID", IsForeignKey = true)]
			public ToDoList ToDoList;

			public int ToDoListID { get; set; }

			public Nullable<DateTime> UpdatedDate { get; set; }

			public Nullable<int> UserID { get; set; }
		}
	}

	// The MetadataTypeAttribute identifies ToDoListMetadata as the class
	// that carries additional metadata for the ToDoList class.
	[MetadataTypeAttribute(typeof(ToDoList.ToDoListMetadata))]
	public partial class ToDoList
	{

		// This class allows you to attach custom attributes to properties
		// of the ToDoList class.
		//
		// For example, the following marks the Xyz property as a
		// required property and specifies the format for valid values:
		//    [Required]
		//    [RegularExpression("[A-Z][A-Za-z0-9]*")]
		//    [StringLength(32)]
		//    public string Xyz { get; set; }
		internal sealed class ToDoListMetadata
		{

			// Metadata classes are not meant to be instantiated.
			private ToDoListMetadata()
			{
			}

			public DateTime CreatedDate { get; set; }

			public string Description { get; set; }

			public string Name { get; set; }

			public Nullable<int> ProjectID { get; set; }

			[Include]
			[Association("FK_ToDoItems_ToDoLists", "ToDoListID", "ToDoListID")]
			public EntityCollection<ToDoItem> ToDoItems { get; set; }

			[Key]
			public int ToDoListID { get; set; }

			public Nullable<DateTime> UpdatedDate { get; set; }
		}
	}

	// The MetadataTypeAttribute identifies UserMetadata as the class
	// that carries additional metadata for the User class.
	[MetadataTypeAttribute(typeof(User.UserMetadata))]
	public partial class User
	{

		// This class allows you to attach custom attributes to properties
		// of the User class.
		//
		// For example, the following marks the Xyz property as a
		// required property and specifies the format for valid values:
		//    [Required]
		//    [RegularExpression("[A-Z][A-Za-z0-9]*")]
		//    [StringLength(32)]
		//    public string Xyz { get; set; }
		internal sealed class UserMetadata
		{

			// Metadata classes are not meant to be instantiated.
			private UserMetadata()
			{
			}

			public DateTime CreatedDate { get; set; }

			public string Email { get; set; }

			public string FirstName { get; set; }

			public string LastName { get; set; }

			public EntityCollection<ToDoItem> ToDoItems { get; set; }

			public Nullable<DateTime> UpdatedDate { get; set; }

			[Key]
			public int UserID { get; set; }
		}
	}
}
